﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NearForums.DataAccess;

namespace NearForums.Services
{
    public class TopicTypeService:ITopicTypeService
    {
        private readonly ITopicTypeDataAccess _dataAccess;

        public TopicTypeService(ITopicTypeDataAccess da)
        {
            _dataAccess = da;
        }

        public void Add(TopicType topicType)
        {
            topicType.ValidateFields();
            _dataAccess.Add(topicType);
        }

        public void UpdateTopicType(TopicType topicType)
        {
            _dataAccess.UpdateTopicType(topicType);
        }

        public List<TopicType> GetTopicTypesByForum(int forumId)
        {
            return _dataAccess.GetTopicTypesByForum(forumId);
        }

        public void AddTopicTypeRelation(TopicTypeRelation topicTypeRel)
        {
            topicTypeRel.ValidateFields();
            _dataAccess.AddTopicTypeRelation(topicTypeRel);
        }

        public void UpdateTopicTypeRelation(TopicTypeRelation topicTypeRel)
        {
            _dataAccess.UpdateTopicTypeRelation(topicTypeRel);
        }

        public void RemoveTopicTypeRelation(TopicTypeRelation topicTypeRel)
        {
            _dataAccess.RemoveTopicTypeRelation(topicTypeRel);
        }
    }
}
